﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VectorEditor
{
	public class TransformPrimitiveCommand : Command
	{
		private HashSet<Primitive> primitives;
		private float offsetX;
		private float offsetY;
		private float scaleX;
		private float scaleY;

		public TransformPrimitiveCommand(HashSet<Primitive> PrimitiveContents, float offsetX, float offsetY, float scaleX, float scaleY)
		{
			// TODO: Complete member initialization
			this.primitives = PrimitiveContents;
			this.offsetX = offsetX;
			this.offsetY = offsetY;
			this.scaleX = scaleX;
			this.scaleY = scaleY;
		}
		public override void Execute(Document doc)
		{
			foreach (var p in primitives)
				p.Transform(offsetX, offsetY, scaleX, scaleY);
		}

		public override void Undo(Document doc)
		{
			foreach (var p in primitives)
				p.Transform(-offsetX, -offsetY, 1.0f / scaleX, 1.0f / scaleY);
		}
	}
}
